<template>
  <div>
    <img src="http://127.0.0.1/heimamm/public/captcha?type=sendsms" alt="" />
    <input type="text" v-model="code" />
    <button @click="btnClick">点击获取验证码</button>
    <button @click="getData">点我调用get</button>
  </div>
</template>
<script>
import { getList, getCode } from '@/api/index.js'
export default {
  data () {
    return {
      code: ''
    }
  },
  methods: {
    getData () {
      getList({ num: 20 }).then(res => {
        window.console.log(res)
      })
    },
    btnClick () {
      getCode({
        code: this.code,
        phone: '13659856585'
      })
        .then(res => {
          window.console.log('res:', res)
          alert(res.data.data.captcha)
          window.console.log(res)
        })
        .catch(error => {
          window.console.log(error)
        })
    }
  }
}
</script>
<style></style>
